Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-watch

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-watch

A wrapper and enhancements for fs.watch

  • 0.7.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is node-watch?

The node-watch package is a simple and efficient file system watcher for Node.js. It allows you to monitor changes in files and directories, making it useful for tasks such as live-reloading, automated testing, and more.

What are node-watch's main functionalities?

Watch a single file

This feature allows you to watch a single file for changes. The callback function is triggered whenever the file is modified.

const watch = require('node-watch');

watch('file.txt', { recursive: false }, function(evt, name) {
  console.log('%s changed.', name);
});

Watch a directory recursively

This feature allows you to watch a directory and all its subdirectories for changes. The callback function is triggered whenever any file within the directory or its subdirectories is modified.

const watch = require('node-watch');

watch('directory', { recursive: true }, function(evt, name) {
  console.log('%s changed.', name);
});

Filter files to watch

This feature allows you to specify a filter to watch only certain types of files. In this example, only JavaScript files within the directory are monitored for changes.

const watch = require('node-watch');

watch('directory', { filter: /\.js$/ }, function(evt, name) {
  console.log('%s changed.', name);
});

Other packages similar to node-watch

Keywords

FAQs

Package last updated on 01 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc